load("//tools/build_defs/android:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
load("//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")
load("//tools/build_defs:glob_defs.bzl", "subdir_glob")

fb_xplat_cxx_library(
    name = "headers_linux",
    header_namespace = "linux",
    exported_headers = subdir_glob([
        ("headers", "*.h"),
    ]),
)

fb_xplat_cxx_library(
    name = "yarn",
    srcs = [
        "Event.cpp",
        "Records.cpp",
        "Session.cpp",
        "detail/AttachmentStrategy.cpp",
        "detail/BufferParser.cpp",
        "detail/RLimits.cpp",
        "detail/Reader.cpp",
        "jni.cpp",
    ],
    header_namespace = "yarn",
    exported_headers = glob([
        "*.h",
        "detail/*.h",
    ]),
    allow_jni_merging = True,
    compiler_flags = [
        "-fvisibility=hidden",
        "-fexceptions",
        "-fPIE",
        "-std=gnu++14",
        "-DLOG_TAG=\"yarn\"",
    ],
    soname = "libprofilo_yarn.$(ext)",
    visibility = [
        profilo_path("..."),
        profilo_path("cpp/yarn/..."),
    ],
    deps = [
        ":headers_linux",
        profilo_path("cpp:constants"),
        profilo_path("cpp:profilo"),
        profilo_path("cpp/logger:logger"),
        profilo_path("cpp/util:util"),
        profilo_path("deps/fb:fb"),
        profilo_path("deps/fbjni:fbjni"),
    ],
)
